ConcreteCargoError {
description: self.description(),
detail: self.detail(),
- cause: self.cause().map(|c| box c.concrete() as Box<CargoError + Send>),
+ cause: self.cause().map(|c| box c.concrete() as Box<CargoError>),
is_human: self.is_human()
}
}
fn from_error(error: E) -> Self;
}
-impl<E: CargoError + Send> FromError<E> for Box<CargoError + Send> {
- fn from_error(error: E) -> Box<CargoError + Send> {
- box error as Box<CargoError + Send>
+impl<E: CargoError> FromError<E> for Box<CargoError> {
+ fn from_error(error: E) -> Box<CargoError> {
+ box error as Box<CargoError>
}
}
}
)
-impl Show for Box<CargoError + Send> {
+impl Show for Box<CargoError> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
try!(write!(f, "{}", self.description()));
Ok(())
}
}
-impl CargoError for Box<CargoError + Send> {
+impl CargoError for Box<CargoError> {
fn description(&self) -> String { (**self).description() }
fn detail(&self) -> Option<String> { (**self).detail() }
fn cause(&self) -> Option<&CargoError> { (**self).cause() }
}
}
-pub type CargoResult<T> = Result<T, Box<CargoError + Send>>;
+pub type CargoResult<T> = Result<T, Box<CargoError>>;
pub trait BoxError<T> {
fn box_error(self) -> CargoResult<T>;
}
pub trait ChainError<T> {
- fn chain_error<E: CargoError + Send>(self, callback: || -> E) -> CargoResult<T> ;
+ fn chain_error<E: CargoError>(self, callback: || -> E) -> CargoResult<T> ;
}
impl<'a, T> ChainError<T> for ||:'a -> CargoResult<T> {
- fn chain_error<E: CargoError + Send>(self, callback: || -> E) -> CargoResult<T> {
+ fn chain_error<E: CargoError>(self, callback: || -> E) -> CargoResult<T> {
self().map_err(|err| callback().concrete().with_cause(err))
}
}
-impl<T, E: CargoError + Send> BoxError<T> for Result<T, E> {
+impl<T, E: CargoError> BoxError<T> for Result<T, E> {
fn box_error(self) -> CargoResult<T> {
- self.map_err(|err| box err as Box<CargoError + Send>)
+ self.map_err(|err| box err as Box<CargoError>)
}
}
-impl<T, E: CargoError + Send> ChainError<T> for Result<T, E> {
- fn chain_error<E: CargoError + Send>(self, callback: || -> E) -> CargoResult<T> {
+impl<T, E: CargoError> ChainError<T> for Result<T, E> {
+ fn chain_error<E: CargoError>(self, callback: || -> E) -> CargoResult<T> {
self.map_err(|err| callback().concrete().with_cause(err))
}
}
pub exit: Option<ProcessExit>,
pub output: Option<ProcessOutput>,
pub detail: Option<String>,
- pub cause: Option<Box<CargoError + Send>>
+ pub cause: Option<Box<CargoError>>
}
from_error!(ProcessError)
pub struct ConcreteCargoError {
description: String,
detail: Option<String>,
- cause: Option<Box<CargoError + Send>>,
+ cause: Option<Box<CargoError>>,
is_human: bool
}
impl ConcreteCargoError {
- pub fn with_cause<E: CargoError + Send>(mut self,
- err: E) -> Box<CargoError + Send> {
- self.cause = Some(box err as Box<CargoError + Send>);
- box self as Box<CargoError + Send>
+ pub fn with_cause<E: CargoError>(mut self, err: E) -> Box<CargoError> {
+ self.cause = Some(box err as Box<CargoError>);
+ box self as Box<CargoError>
}
- pub fn mark_human(mut self) -> Box<CargoError + Send> {
+ pub fn mark_human(mut self) -> Box<CargoError> {
self.is_human = true;
- box self as Box<CargoError + Send>
+ box self as Box<CargoError>
}
}
#[deriving(Show)]
pub struct CliError {
- pub error: Box<CargoError + Send>,
+ pub error: Box<CargoError>,
pub unknown: bool,
pub exit_code: uint
}
}
pub fn from_error<E: CargoError + 'static>(error: E, code: uint) -> CliError {
- let error = box error as Box<CargoError + Send>;
+ let error = box error as Box<CargoError>;
CliError::from_boxed(error, code)
}
- pub fn from_boxed(error: Box<CargoError + Send>, code: uint) -> CliError {
+ pub fn from_boxed(error: Box<CargoError>, code: uint) -> CliError {
let human = error.is_human();
CliError { error: error, exit_code: code, unknown: !human }
}
exit: status.map(|o| o.clone()),
output: output.map(|o| o.clone()),
detail: None,
- cause: cause.map(|c| box c as Box<CargoError + Send>)
+ cause: cause.map(|c| box c as Box<CargoError>)
}
}
pub fn internal_error<S1: Str, S2: Str>(error: S1,
- detail: S2) -> Box<CargoError + Send> {
+ detail: S2) -> Box<CargoError> {
box ConcreteCargoError {
description: error.as_slice().to_string(),
detail: Some(detail.as_slice().to_string()),
cause: None,
is_human: false
- } as Box<CargoError + Send>
+ } as Box<CargoError>
}
-pub fn internal<S: Show>(error: S) -> Box<CargoError + Send> {
+pub fn internal<S: Show>(error: S) -> Box<CargoError> {
box ConcreteCargoError {
description: error.to_string(),
detail: None,
cause: None,
is_human: false
- } as Box<CargoError + Send>
+ } as Box<CargoError>
}
-pub fn human<S: Show>(error: S) -> Box<CargoError + Send> {
+pub fn human<S: Show>(error: S) -> Box<CargoError> {
box ConcreteCargoError {
description: error.to_string(),
detail: None,
cause: None,
is_human: true
- } as Box<CargoError + Send>
+ } as Box<CargoError>
}
-pub fn caused_human<S: Show, E: CargoError + Send>(error: S, cause: E) -> Box<CargoError + Send> {
+pub fn caused_human<S: Show, E: CargoError>(error: S, cause: E) -> Box<CargoError> {
box ConcreteCargoError {
description: error.to_string(),
detail: None,
- cause: Some(box cause as Box<CargoError + Send>),
+ cause: Some(box cause as Box<CargoError>),
is_human: true
- } as Box<CargoError + Send>
+ } as Box<CargoError>
}